package com.tjec.project.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tjec.framework.aspectj.lang.annotation.Log;
import com.tjec.framework.aspectj.lang.enums.BusinessType;
import com.tjec.project.system.domain.BmsMdAuditWorkflowConfig;
import com.tjec.project.system.service.IBmsMdAuditWorkflowConfigService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.tjec.framework.web.controller.BaseController;
import com.tjec.framework.web.domain.AjaxResult;
import com.tjec.common.utils.poi.ExcelUtil;
import com.tjec.framework.web.page.TableDataInfo;

/**
 * 成果校审流程配置Controller
 * 
 * @author tjec
 * @date 2020-04-16
 */
@Api(value = "成果校审流程配置接口", tags = {"成果校审流程配置接口"})
@RestController
@RequestMapping("/system/auditWorkflowConfig")
public class BmsMdAuditWorkflowConfigController extends BaseController
{
    @Autowired
    private IBmsMdAuditWorkflowConfigService bmsMdAuditWorkflowConfigService;

    /**
     * 查询成果校审流程配置列表
     */
    @ApiOperation("成果校审流程配置列表")
    //@PreAuthorize("@ss.hasPermi('system:auditWorkflowConfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(BmsMdAuditWorkflowConfig bmsMdAuditWorkflowConfig)
    {
        startPage();
        List<BmsMdAuditWorkflowConfig> list = bmsMdAuditWorkflowConfigService.selectBmsMdAuditWorkflowConfigList(bmsMdAuditWorkflowConfig);
        return getDataTable(list);
    }

    /**
     * 导出成果校审流程配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:auditWorkflowConfig:export')")
    @Log(title = "成果校审流程配置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BmsMdAuditWorkflowConfig bmsMdAuditWorkflowConfig)
    {
        List<BmsMdAuditWorkflowConfig> list = bmsMdAuditWorkflowConfigService.selectBmsMdAuditWorkflowConfigList(bmsMdAuditWorkflowConfig);
        ExcelUtil<BmsMdAuditWorkflowConfig> util = new ExcelUtil<BmsMdAuditWorkflowConfig>(BmsMdAuditWorkflowConfig.class);
        return util.exportExcel(list, "auditWorkflowConfig");
    }

    /**
     * 获取成果校审流程配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:auditWorkflowConfig:query')")
    @GetMapping(value = "/{guid}")
    public AjaxResult getInfo(@PathVariable("guid") String guid)
    {
        return AjaxResult.success(bmsMdAuditWorkflowConfigService.selectBmsMdAuditWorkflowConfigById(guid));
    }

    /**
     * 新增成果校审流程配置
     */
    @PreAuthorize("@ss.hasPermi('system:auditWorkflowConfig:add')")
    @Log(title = "成果校审流程配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BmsMdAuditWorkflowConfig bmsMdAuditWorkflowConfig)
    {
        return toAjax(bmsMdAuditWorkflowConfigService.insertBmsMdAuditWorkflowConfig(bmsMdAuditWorkflowConfig));
    }

    /**
     * 修改成果校审流程配置
     */
    @PreAuthorize("@ss.hasPermi('system:auditWorkflowConfig:edit')")
    @Log(title = "成果校审流程配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BmsMdAuditWorkflowConfig bmsMdAuditWorkflowConfig)
    {
        return toAjax(bmsMdAuditWorkflowConfigService.updateBmsMdAuditWorkflowConfig(bmsMdAuditWorkflowConfig));
    }

    /**
     * 删除成果校审流程配置
     */
    @PreAuthorize("@ss.hasPermi('system:auditWorkflowConfig:remove')")
    @Log(title = "成果校审流程配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids)
    {
        return toAjax(bmsMdAuditWorkflowConfigService.deleteBmsMdAuditWorkflowConfigByIds(guids));
    }
}
